﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Applee.FractCommon
{
    public abstract class BaseShape : IDrawable, IShape
    {
        #region IShape 成员

        protected PointF[] points = null;

        public PointF[] Points
        {
            get { return points; }
            set { points = value; }
        }

        protected Color mColor = new Color();
        public Color Color
        {
            get { return mColor; }
            set { mColor = value; }
        }

        public void MakeShape(System.Drawing.PointF point, float fLength)
        {
            if (points == null)
                throw new Exception("points 点集没有初始化！");

            DoMakeShape(point, fLength);
        }

        public abstract void DoMakeShape(System.Drawing.PointF point, float fLength);

        #endregion

        #region IDrawable 成员

        public void OnPaint(System.Windows.Forms.PaintEventArgs pe)
        {
            Brush brush = new SolidBrush(mColor);
            pe.Graphics.FillPolygon(brush, points);
        }

        #endregion
    }
}
